package cn.tradewin.advisor.pages.passets.checklist;

import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import cn.tradewin.advisor.persist.model.CodingChk;
import cn.tradewin.advisor.persist.services.CodingChkService;

public class CodingEdit {
	
	private Integer code;
	
	@Property
	private CodingChk codeChk;
	
	@Inject
	private CodingChkService codeChkService;
	
	void onActivate(Integer code) {
		this.code = code;
	}
	
	void onPrepareForRender() {
		codeChk = codeChkService.findCodingChk(code);
	}
	
	void onPrepareForSubmit() {
		codeChk = new CodingChk();
	}
	
	Object onSubmit() {
		codeChkService.update(codeChk);
		return CodingBoard.class;
	}
}
